Напишите программу, которая проверит, что число является совершенным. Совершенное число - натуральное число, равное сумме всех своих собственных делителей. Например, число 6 равно сумме своих собственных делителей 1 + 2 + 3.
Примеры совершенных чисел:
6, 28, 496, 8128
Решение:
def get_divisors(num): divisors = [] for i in range(1, num): if num % i == 0: divisors.append(i) return divisors
def perfect_num(num): divisors = get_divisors(num) return num == sum(divisors)
Напишите программу, которая проверит, что число является совершенным. Совершенное число - натуральное число, равное сумме всех своих собственных делителей. Например, число 6 равно сумме своих собственных делителей 1 + 2 + 3.
Примеры совершенных чисел:
6, 28, 496, 8128
Решение:
def get_divisors(num): divisors = [] for i in range(1, num): if num % i == 0: divisors.append(i) return divisors
def perfect_num(num): divisors = get_divisors(num) return num == sum(divisors)
Tata Power whose core business is to generate, transmit and distribute electricity has made no money to investors in the last one decade. That is a big blunder considering it is one of the largest power generation companies in the country. One of the reasons is the company's huge debt levels which stood at ₹43,559 crore at the end of March 2021 compared to the company’s market capitalisation of ₹44,447 crore.
What is Telegram?
Telegram is a cloud-based instant messaging service that has been making rounds as a popular option for those who wish to keep their messages secure. Telegram boasts a collection of different features, but it’s best known for its ability to secure messages and media by encrypting them during transit; this prevents third-parties from snooping on messages easily. Let’s take a look at what Telegram can do and why you might want to use it.
Python Turbo Уютное сообщество Python разработчиков from ms